package cn.geminis.lowcode.compiler.code;

import cn.geminis.lowcode.compiler.util.JdkTreeMakerUtils;
import com.sun.source.tree.BlockTree;
import com.sun.source.tree.Tree;
import lombok.RequiredArgsConstructor;

import java.util.List;

/**
 * @author puddi
 */
@RequiredArgsConstructor
public class LcBlock extends AbstractStatement<BlockTree> {

    private final List<AbstractStatement<?>> statements;

    @Override
    protected BlockTree createJdkTree() {
        return JdkTreeMakerUtils.block((List<Tree>) statements.stream().map(AbstractCode::getJdkTree).toList());
    }

}
